home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / popd.pro < prev    next >
Text File  |  1997-07-08  |  1KB  |  45 lines

  1. ; $Id: popd.pro,v 1.3 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1989-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. ;+
  7. ; NAME:
  8. ;    POPD
  9. ;
  10. ; PURPOSE:
  11. ;    Change the current working directory to the directory
  12. ;    saved on the top of the directory stack maintained
  13. ;    by the PUSHD and POPD User Library procedures. This top entry
  14. ;    is then removed.
  15. ;
  16. ; CALLING SEQUENCE:
  17. ;    POPD
  18. ;
  19. ; SIDE EFFECTS:
  20. ;    The top entry of the directory stack is removed.
  21. ;
  22. ; RESTRICTIONS:
  23. ;    Popping a directory from an empty stack causes a warning
  24. ;    message to be printed.  The current directory is not changed
  25. ;    in this case.
  26. ;
  27. ; COMMON BLOCKS:
  28. ;    DIR_STACK:  Contains the stack.
  29. ;
  30. ; MODIFICATION HISTORY:
  31. ;    17, July, 1989, Written by AB, RSI.
  32. ;-
  33. ;
  34. ;
  35. pro popd
  36.  
  37. COMMON DIR_STACK, DEPTH, STACK
  38. on_error, 2        ; Return to caller on error
  39. if (n_elements(DEPTH) eq 0) then depth = 0
  40. if (DEPTH eq 0) then message, 'Directory stack is empty.'
  41. cd, stack[0]
  42. DEPTH = DEPTH - 1
  43. if (DEPTH eq 0) then STACK = 0 else STACK = STACK[1:*]
  44. end
  45.